﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FileManagerSystem.Extend
{
    /// <summary>
    /// 数字扩展
    /// </summary>
    public static class NumExtend
    {
        /// <summary>
        /// Int32转化成指定长度的字符串
        /// len:0不转化
        /// 数字长度超过len，则不需要进行补位
        /// </summary>
        /// <param name="num">待转化数字</param>
        /// <param name="len">字符串长度</param>
        /// <returns></returns>
        public static string IntToStr(this int num, int len = 0)
        {
            string str = num.ToString();
            if (!(len == 0 || str.Length > len))
            {
                str = str.PadLeft(len, '0');
            }
            return str;

        }
    }
}
